//
//  CityModelDataSourceProtocolTests.swift
//  travelMapMvvm-swift2
//
//  Created by green on 15/11/4.
//  Copyright © 2015年 travelMapMvvm-swift2. All rights reserved.
//

import Foundation
import XCTest
import ReactiveCocoa
import TMDatasourceLib
import TMCommonLib

class CityModelDataSourceProtocolTests: XCTestCase {

    var cityModelDataSourceProtocol: CityModelDataSourceProtocol!
    
    override func setUp() {
        super.setUp()
        
        cityModelDataSourceProtocol = CityModelDataSource.shareInstance()
    }
    
    override func tearDown() {
        super.tearDown()
    }
    
    /**
     查询关键字城市列表测试
     */
    func testQueryCityListByKeyword() {
        
        let expectation = expectationWithDescription(kURL+"getDestination")
        
        cityModelDataSourceProtocol.queryCityListByKeyword("纽约").subscribeNext({ (any:AnyObject!) -> Void in
            
            expectation.fulfill()
            XCTAssert(any is [CityModel],"response obj is not [CityModel]")
            
            print(any as! [CityModel])
            
        }, error: { (error:NSError!) -> Void in
            
            expectation.fulfill()
            XCTFail(error.localizedDescription)
            
        })
        
        waitForExpectationsWithTimeout(10, handler: {error in
        })
    }
}